-	script	whois	-1,{
	OnWhisperGlobal:

		//Minumum GM level to access this function
		set @gmlevel,20;

		if(getgmlevel() >= @gmlevel)
		{
			//Header message
			dispbottom " ";
			dispbottom "User WHOIS";
			dispbottom "--------------------";

			//Collect the account ID
			set @results,query_sql("SELECT `account_id` FROM `char` WHERE `name`='"+@whispervar0$+"'",@account_id);
			if(@results == 1)
			{
				//Select the user's IP
				query_sql("SELECT `last_ip` FROM `login` WHERE `account_id`='"+@account_id+"'",@last_ip$);

				//Select accounts
				set @accounts,query_sql("SELECT `account_id`,`userid`,`lastlogin` FROM `login` WHERE `last_ip`='"+@last_ip$+"'",@account_id,@userid$,@lastlogin$);

				//Cycle accounts
				for(set @i,0; @i<@accounts; set @i,@i+1)
				{
					dispbottom "Account: "+@userid$[@i];
					dispbottom "Last login: "+@lastlogin$[@i];

					//Select chars
					set @chars,query_sql("SELECT `name`,`base_level`,`job_level`,`class` FROM `char` WHERE `account_id`='"+@account_id[@i]+"'",@name$,@base_level,@job_level,@class);

					//Cycle chars
					for(set @c,0; @c<@chars; set @c,@c+1)
					{
						dispbottom "Char: "+@name$[@c]+" ("+@base_level[@c]+"/"+@job_level[@c]+" "+jobname(@class[@c])+")";
					}

					dispbottom "--------------------";
				}
				dispbottom " ";
			}
			else
			{
				dispbottom "Search: "+@whispervar0$;
				dispbottom "No user by that name found";
				dispbottom "--------------------";
				dispbottom " ";
			}
		}
		else
		{
			dispbottom "Server:  Sorry, you do not have permission to use this feature.";
		}

		end;
}